<html>
<head>

    <link href="{$Think.config.RESOURCEURL}wx_assets/css/common.css{$Think.config.RESOURCE_VER}" rel="stylesheet" type="text/css">
    <link href="{$Think.config.RESOURCEURL}wx_assets/shenqi/shenqi.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
    <link href="{$Think.config.RESOURCEURL}wx_assets/shenqi/jquery-sinaEmotion.css{$Think.config.RESOURCE_VER}" rel="stylesheet">
    <script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/jquery-1.8.2.min.js{$Think.config.RESOURCE_VER}"></script>
    <script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.alert.js{$Think.config.RESOURCE_VER}"></script>
    <script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/shenqi/js/jquery-sinaEmotion.js{$Think.config.RESOURCE_VER}"></script>
    <script src="{$Think.config.RESOURCEURL}wx_assets/js/util.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script src="{$Think.config.RESOURCEURL}wx_assets/js/wx_share.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>

</head>

<body>

123

<script>

    var baseUrl = '{$Think.config.SERVER_HOST}';
    var WX = {
        /*
         * 获取微信支付参数
         * oid:订单id
         * desc:商品描述显示在微信支付界面中
         * productFee:产品价格
         * module:回调模块
         * moduleId:回调模块id
         * transportFee:运费单位分
         * userName:用户openid
         * method:回调方法
         */
        WxPayParamAjax: function(oid, desc, productFee, module, moduleId, transportFee, userName, method) {

            alert(userName);

            var urlString = baseUrl + 'Wxpay/getWxPayParam.json?customerId={$customerId}';

            alert(urlString);

            var me=this;
            $.ajax({
                url: urlString,
                dataType: "json",
                type: "post",
                data: {
                    'sn': 0,
                    'desc': desc,
                    'productFee': productFee,
                    'module': module,
                    'moduleId': moduleId,
                    'transportFee': transportFee,
                    'userName': userName,
                    'method': method
                }, success: function(d) {
                        alert('success');
                    $.util.pageLoading.hide();
                    if (d.code) {
                        alert('error1');
                        $.util.alert(d.msg);
                        return;
                    }
                    alert('error2');
                    alert(JSON.stringify(d.pkg));
                    WeixinJSBridge.invoke('getBrandWCPayRequest', d.pkg, function(res) {

                        alert('error3');
                        WeixinJSBridge.log(res.err_msg);
                        if (res.err_msg == 'get_brand_wcpay_request:ok') {

                            alert('error4');
                            me._getFreeList(function(){
                                $(".pay dd").eq(me.activeIndex).addClass("current");
                            });
                        } else  {

                            alert('error5');
                            var res = res;
                            $(".pay dd").eq(me.activeIndex).removeClass("current");
                            if (res.err_msg == 'get_brand_wcpay_request:cancel') {

                                alert('error6');
                                return alert("操作已取消"), void 0
                            } else if (res.err_msg == 'get_brand_wcpay_request:fail') {

                                alert('error7');
                                return alert("网络错误发送失败，请稍后再试"), void 0
                            } else if (res.err_msg == 'access_control:not_allow' || res.err_msg == 'system:access_denied') {

                                alert('error8');
                                return alert("商家尚未开通微信支付"), void 0
                            } else {

                                alert('error9');
                                return alert(res.err_msg), void 0
                            }
                        }
                    });
         }, error: function () {
                    alert('error');
                }
            });
        },
    };

    setTimeout(function () {
        alert("start");
        WX.WxPayParamAjax(0, "打开微信支", 0.01, "entry", 40, 0, "{$userName}", "payCallBack");
    }, 10000);

</script>

</body>
</html>